//
//  PopDirctViewController.m
//  day-02-TopView
//
//  Created by hcios on 2017/6/30.
//  Copyright © 2017年 hcios. All rights reserved.
//

#import "PopDirctViewController.h"

#import "SelectedView.h"

#import "InsideViewController.h"
#import "OutsideViewController.h"


#define kScreenWidth [UIScreen mainScreen].bounds.size.width
#define kScreenHeight [UIScreen mainScreen].bounds.size.height


@interface PopDirctViewController ()

@end

@implementation PopDirctViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setUpNavView];
    [self setUpSelectedView];
    
}


-(void)setUpNavView{
    
    //view
    UIView *navView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 64)];
    navView.backgroundColor = [UIColor colorWithRed:30 / 255.0f green:144 / 255.0f blue:255 / 255.0f alpha:1.0];
    navView.userInteractionEnabled = YES;
    [self.view addSubview:navView];
    
    //btn
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn setFrame:CGRectMake(20, 14, 40, 40)];
    [btn.titleLabel setFont:[UIFont systemFontOfSize:16]];
    [btn setTitle:@"退出" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btn setBackgroundColor:[UIColor clearColor]];
    [btn addTarget:self action:@selector(deleteVC) forControlEvents:UIControlEventTouchUpInside];
    [navView addSubview:btn];
}

-(void)setUpSelectedView{
    
    InsideViewController *insideVC = [[InsideViewController alloc] init];
    OutsideViewController *outsideVC = [[OutsideViewController alloc] init];
    
    NSArray *nameArr = @[@"国内",@"国外"];
    NSArray *VCArr = @[insideVC,outsideVC];
    
    SelectedView *selectedView = [[SelectedView alloc] initWithFrame:CGRectMake(0, 64, kScreenWidth, kScreenHeight - 64) buttonName:nameArr controllers:VCArr parentController:self];
    
    [self.view addSubview:selectedView];
}


-(void)deleteVC{
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
